package com.hq.erp.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hq.erp.model.Product;
import com.hq.erp.service.ProductService;

@Controller
public class MainController {
	@Autowired
	private ProductService productService;
	
	@RequestMapping("/main")
	public String main(){
		System.out.println("main handler");
		return "/Bootstrap.html";
	}
	@RequestMapping("/product_list")
	public String productList(Model model){
		System.out.println("list handler");
		List<Product> products = productService.getProudcts();
		model.addAttribute("products", products);
		return "/product_list.jsp";
	}

}
